<!doctype html>
<html>
  <head>
    <script src="/script/webintents-server.js"></script>
    <script src="/script/controller.js"></script>
    <script>
      window.attachEventListener = function(obj, type, func, capture) {
        if(!!obj.addEventListener) {
          obj.addEventListener(type, func, capture);
        }
        else if(!!obj.attachEvent) {
          obj.attachEvent("on" + type, func);
        }
      };

      attachEventListener(window, "load", function() {
        var clearall = document.getElementById("clearall");
        attachEventListener(clearall, "click", function() {
          Intents.clearAll()
          window.location.reload();
        });
        
        var actions = Intents.getAllActions();
         
        for(var key in actions) {
          var action = actions[key];
          var root = IntentController.renderActionContainer(action, document.body);
          
          IntentController.renderActions(action.actions, undefined, root);
        }
      }, false);
    </script>
  </head>
  <body>
    <h1>Intents</h1>
    <div>
      <p></p>
      <div><a id="clearall" href="#" >Clear all</a></div>
    </div>
  </body>
</html>
